package com.iecampus.fragment;

import java.lang.reflect.Type;
import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.google.gson.reflect.TypeToken;
import com.iecampus.activity.R;
import com.iecampus.moldel.User;
import com.iecampus.utils.JsonUtil;

public class ContactFragment extends Fragment {
	private TextView mobile, email, qq;
	private String jsonData;

	public ContactFragment(String jsonData) {
		this.jsonData = jsonData;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		initData();
	}

	private void initData() {
		if (!TextUtils.isEmpty(jsonData)) {
			try {
				JSONObject object = new JSONObject(jsonData);
				this.mobile.setText(object.getString("tel"));
				this.email.setText(object.getString("email"));
				this.qq.setText(object.getString("qq"));
			} catch (JSONException e) {
				e.printStackTrace();
			}
		}
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.personal_data, null);
		this.mobile = (TextView) rootView.findViewById(R.id.mobile);
		this.qq = (TextView) rootView.findViewById(R.id.qq);
		this.email = (TextView) rootView.findViewById(R.id.email);
		return rootView;
	}
}
